﻿Imports System.Text
Namespace ReplyMsg
    Public Class ReplyNewsMsg
        Inherits ReplyBaseMsg

        Public Class News
            Public Property Title() As String

            Public Property Description() As String

            Public Property PicUrl() As String

            Public Property Url() As String
        End Class

        Public Overrides ReadOnly Property MsgType() As String
            Get
                Return "news"
            End Get
        End Property

        Public Property Articles() As List(Of ReplyNewsMsg.News)

        Protected Overrides Function GetXMLPart() As String
            Dim sb As StringBuilder = New StringBuilder()
            sb.AppendFormat("<ArticleCount>{0}</ArticleCount>", Articles.Count)
            sb.AppendFormat("<Articles>")
            For Each news As ReplyNewsMsg.News In Me.Articles
                sb.Append("<item>")
                sb.AppendFormat("<Title><![CDATA[{0}]]></Title>", news.Title)
                sb.AppendFormat("<Description><![CDATA[{0}]]></Description>", news.Description)
                sb.AppendFormat("<PicUrl><![CDATA[{0}]]></PicUrl>", news.PicUrl)
                sb.AppendFormat("<Url><![CDATA[{0}]]></Url>", news.Url)
                sb.Append("</item>")
            Next
            sb.AppendFormat("</Articles>")
            Return sb.ToString()
        End Function
    End Class
End Namespace

